package com.plian.system.wrapper.im;

import com.plian.system.dto.im.FundProjectInfoDTO;
import com.plian.system.entity.im.FundProjectInfo;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.im.FundProjectInfoVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.*;

/**
 * @description:
 * @author: gangan
 * @create: 2020-04-23 14:14
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface FundProjectInfoWrapper extends BaseWrapper<FundProjectInfo, FundProjectInfoDTO, FundProjectInfoVO> {

    /**
     * Entity转VO
     *
     * @param entity /
     * @return /
     */
    @Override
    @Mappings(value = {
            @Mapping(source = "companyId", target = "companyName", qualifiedByName = PROPERTY_ID_NAME),
            @Mapping(source = "fundCategory", target = "fundCategoryName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "manageMode", target = "manageModeName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "fundType", target = "fundTypeName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "organizationForm", target = "organizationFormName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "fundStatus", target = "fundStatusName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "managerType", target = "managerTypeName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "projectSituation", target = "projectSituationName", qualifiedByName = DICT_CODE_TO_NAME),
            @Mapping(source = "fundNature", target = "fundNatureName", qualifiedByName = DICT_CODE_TO_NAME)
    })
    FundProjectInfoVO entityToVO(FundProjectInfo entity);
}
